package com.project.service;


import com.project.common.utils.MyPageHelper;
import com.project.dao.AnswerRecordMapper;
import com.project.dao.ExamMapper;
import com.project.entity.AnswerRecord;
import com.project.entity.Exam;
import com.project.entity.ExerciseInfo;
import com.project.myBeans.ExerciseDetail;
import com.project.service.base.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional(rollbackFor = {Exception.class})
@Service
public class ExamServiceImpl extends BaseService implements ExamService
{
    @Autowired
    ExamMapper examMapper;

    @Autowired
    AnswerRecordMapper answerRecordMapper;

    @Override
    public List<Exam> findByCourseid(Integer courseid)
    {
        return examMapper.selectByCourseid(courseid);
    }

    @Override
    public Exam findById(Integer id)
    {
        return examMapper.selectById(id);
    }

    @Override
    public Exam findByExampaperId(Integer exampaperid)
    {
        return examMapper.selectByExampaperId(exampaperid);
    }

    @Override
    public int add(Exam exam){return examMapper.insertSelective(exam);}
    @Override
    public int remove(Integer id){return examMapper.deleteByPrimaryKey(id);}

    @Override
    public List<Exam> findByStudentid(Integer studentid)
    {
        return examMapper.selectByStudentid(studentid);
    }

    @Override
    public List<Exam> findBycourseteachid(Integer courseteachid) {
        return examMapper.selectBycourseteachid(courseteachid);
    }

    @Override
    public int modify(Exam exam) {
        return examMapper.updateByPrimaryKeySelective(exam);
    }

    @Override
    public List<Exam> GetAllExam() {
        return examMapper.GetAllExam();
    }


}
